import { Inject, Injectable } from '@nestjs/common';
import { CreateLabelDto } from './dto/create-label.dto';
import { UpdateLabelDto } from './dto/update-label.dto';
import { ClientProxy } from '@nestjs/microservices';
import { QueryDto } from './dto/query.dto';

@Injectable()
export class LabelsService {
    constructor(
        @Inject('STORE_SERVICE') private readonly storeService: ClientProxy,
    ) {

    }

  create(createLabelDto: CreateLabelDto) {
    return this.storeService.send('createLabel', createLabelDto);
  }

  findAll(query:QueryDto) {
    return this.storeService.send('findAllLabels', query);
  }

  findOne(id: number) {
    return this.storeService.send('findOneLabel', id);
  }

  update(id: number, updateLabelDto: UpdateLabelDto) {
    return this.storeService.send('updateLabel', {id,updateLabelDto});
  }

  remove(id: number) {
    return this.storeService.send('removeLabel', id);
  }
}
